--row_number最新一筆
select * from (
select *, row_number() over (
partition by Station,EMPNO
order by VGRR_Date desc
) as row_num
from VGRR_REC
) as VGRR_REC2
where VGRR_REC2.row_num = 1 and VGRR_Result = '合格'